{extends file="../home.html"}
{block name="title"}{$head_title}{/block}
{block name="css"}
<link rel="stylesheet" style="text/css" href="__PUBLIC__/Css/front/user_glb.css?version={$version}">
{/block}
{block name="content"}
	<!--所有记录 -->
<div class="detail_list_cont">
  	<!--一条记录 -->
    <div class="dlist_cont">
        <div class="dlist_content" id="going_list">
            {foreach from=$freight_coupon_list item=freight_coupon}
            <div class="dlink_record">
				<p> <span>面额：</span> <i> &yen;{$freight_coupon.num} </i></p>								
				<p> <span>有效期至：</span> <em> {$freight_coupon.deadline|date_format:"%Y-%m-%d %H:%M:%S"} </em> </p>
				<p> <span>状态：</span> <em> {$freight_coupon.state_name} </em> </p>
			</div>
            {/foreach}
        </div>
    </div>
</div>
{if !$freight_coupon_list}
<div class="dlist_error"> —————— &nbsp;&nbsp;暂时没有记录&nbsp;&nbsp;—————— </div>
{/if}
{/block}
{block name="js"}
<script type="text/javascript">
var firstRow = parseInt('{$firstRow}');
var total = parseInt('{$total}');
{literal}
$(function(){  
    var range = 500; //距下边界长度/单位px  
    var elemt = 500; //插入元素高度/单位px  
    var num = firstRow;  
    var totalheight = 0;  
    var main = $("#going_list"); //主体元素  
    $(window).scroll(function(){  
      var srollPos = $(window).scrollTop(); //滚动条距顶部距离(页面超出窗口的高度)  
      totalheight = parseFloat($(window).height()) + parseFloat(srollPos);  
      if(($(window).height()+range) <= totalheight  && total > num)
      {  
        num = parseInt(num) + parseInt(firstRow);
        //获取商品列表
        $.post('/FrontShare/freight_coupon_list', {"firstRow":num - parseInt(firstRow)}, function(data, textStatus)
         {
          if (data != 'failure')
          {
            var len = data.length;
            console.log(len);
            for (i = 0; i < len; i++)
            {
				var html = '<div class="dlink_record"><p><span>面额：</span><i>&yen;'+data[i].num+'</i></p><p><span>有效期至：</span> <em>'+data[i].deadline+'</em> </p><p> <span>状态：</span> <em>'+data[i].state_name+'</em> </p></div>';
				main.append(html);  
            }
          }
        }, 'json');
      } 
		else
      {
        $('#item_ending').show();
      }
    }); 
    
  }); 
</script>
{/literal}
{/block}
